package com.examiner.dao;

import com.examiner.bean.test.NewTestDepartment;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface NewTestDepartmentDao extends JpaRepository<NewTestDepartment,Integer>, JpaSpecificationExecutor<NewTestDepartment> {
    List<NewTestDepartment> findAllByNid(Integer id);

    @Query(value = "delete from new_test_department where nid=?1", nativeQuery = true)
    @Modifying(clearAutomatically = true)
    void deleteAllByNid(Integer id);
}
